/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iodegree;

import iodegree.lib.MyTableModel;
import iodegree.lib.CommonsLib;
import iodegree.lib.StatisticsConversion;
import iodegree.lib.URIHandle;
import iodegree.lib.quadro.GenBoth;
import iodegree.lib.quadro.GenIO;
import java.awt.Color;
import java.io.File;
import javax.swing.JFileChooser;
import org.apache.commons.math3.stat.descriptive.SummaryStatistics;

/**
 *
 * @author Libra
 */
public class IO extends javax.swing.JFrame {

    /**
     * Creates new form IoUIMain
     */
    public IO() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        DataFileChooser = new javax.swing.JFileChooser();
        gluGABAGroup = new javax.swing.ButtonGroup();
        inOutGroup = new javax.swing.ButtonGroup();
        jPanel2 = new javax.swing.JPanel();
        txtTotalCell = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtCycles = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        btnGenRnd = new javax.swing.JButton();
        btnOpenDbDefault = new javax.swing.JButton();
        txtTotalConn = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        lblOpenDatabase = new javax.swing.JLabel();
        btnOpenDatabase = new javax.swing.JButton();
        rdoOutput = new javax.swing.JRadioButton();
        rdoGlu = new javax.swing.JRadioButton();
        lblQueryOption = new javax.swing.JLabel();
        lblDoQuery = new javax.swing.JLabel();
        btnQuery = new javax.swing.JButton();
        rdoInput = new javax.swing.JRadioButton();
        rdoGABA = new javax.swing.JRadioButton();
        chkGluOnly = new javax.swing.JCheckBox();
        rdoBoth = new javax.swing.JRadioButton();
        lblEmail = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jPanel1 = new javax.swing.JPanel();
        qryPane = new javax.swing.JScrollPane();
        qryTable = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("IO Degree Distribution");

        txtTotalCell.setEditable(false);
        txtTotalCell.setText("0");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel8.setText("Cycles");

        txtCycles.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtCycles.setText("1000");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("5. Random Sim :");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel10.setText("Total Cells");

        btnGenRnd.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnGenRnd.setText("Generate");
        btnGenRnd.setEnabled(false);
        btnGenRnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGenRndActionPerformed(evt);
            }
        });

        btnOpenDbDefault.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnOpenDbDefault.setText("Default");
        btnOpenDbDefault.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOpenDbDefaultActionPerformed(evt);
            }
        });

        txtTotalConn.setEditable(false);
        txtTotalConn.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtTotalConn.setText("0");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel6.setText("Total Connections");

        lblOpenDatabase.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lblOpenDatabase.setText("1. Open Database File :");

        btnOpenDatabase.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnOpenDatabase.setText("Open");
        btnOpenDatabase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOpenDatabaseActionPerformed(evt);
            }
        });

        inOutGroup.add(rdoOutput);
        rdoOutput.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        rdoOutput.setText("Output");
        rdoOutput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdoOutputActionPerformed(evt);
            }
        });

        gluGABAGroup.add(rdoGlu);
        rdoGlu.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        rdoGlu.setSelected(true);
        rdoGlu.setText("Glu");
        rdoGlu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdoGluActionPerformed(evt);
            }
        });

        lblQueryOption.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lblQueryOption.setText("2. Query Option:");

        lblDoQuery.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lblDoQuery.setText("3. Perform Query :");

        btnQuery.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnQuery.setText("Query");
        btnQuery.setEnabled(false);
        btnQuery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQueryActionPerformed(evt);
            }
        });

        inOutGroup.add(rdoInput);
        rdoInput.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        rdoInput.setSelected(true);
        rdoInput.setText("Input");
        rdoInput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdoInputActionPerformed(evt);
            }
        });

        gluGABAGroup.add(rdoGABA);
        rdoGABA.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        rdoGABA.setText("GABA");
        rdoGABA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdoGABAActionPerformed(evt);
            }
        });

        chkGluOnly.setText("Glu Only");

        inOutGroup.add(rdoBoth);
        rdoBoth.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        rdoBoth.setText("Both");
        rdoBoth.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdoBothActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblOpenDatabase)
                    .addComponent(lblQueryOption)
                    .addComponent(lblDoQuery)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnOpenDatabase)
                    .addComponent(rdoGlu)
                    .addComponent(rdoInput)
                    .addComponent(btnQuery)
                    .addComponent(txtCycles, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnOpenDbDefault)
                            .addComponent(rdoGABA)
                            .addComponent(jLabel6)
                            .addComponent(jLabel10)
                            .addComponent(jLabel8))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtTotalCell, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtTotalConn, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(chkGluOnly)
                            .addComponent(btnGenRnd)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rdoOutput)
                        .addGap(18, 18, 18)
                        .addComponent(rdoBoth)))
                .addGap(0, 139, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblOpenDatabase)
                    .addComponent(btnOpenDatabase)
                    .addComponent(btnOpenDbDefault))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblQueryOption)
                    .addComponent(rdoGlu)
                    .addComponent(rdoGABA)
                    .addComponent(chkGluOnly))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(rdoInput)
                    .addComponent(rdoOutput)
                    .addComponent(rdoBoth))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lblDoQuery)
                    .addComponent(btnQuery)
                    .addComponent(jLabel6)
                    .addComponent(txtTotalConn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txtTotalCell, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(20, 20, 20)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel7)
                    .addComponent(txtCycles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(btnGenRnd))
                .addGap(40, 40, 40))
        );

        lblEmail.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        lblEmail.setText("zhangxiaoxing@ion.ac.cn");
        lblEmail.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblEmailMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                lblEmailMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                lblEmailMouseExited(evt);
            }
        });

        qryTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        qryPane.setViewportView(qryTable);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(qryPane)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(qryPane, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(418, Short.MAX_VALUE)
                .addComponent(lblEmail)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jSeparator1)
                .addGap(10, 10, 10))
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(280, 280, 280)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblEmail)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(200, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnOpenDatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenDatabaseActionPerformed
        int returnVal = DataFileChooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            pathToFile = DataFileChooser.getSelectedFile().getAbsolutePath();
//            System.out.println("File " + pathToFile + " opened.");
        }
        File f = new File(pathToFile);
        if (f.exists()) {
            btnQuery.setEnabled(true);
        }
    }//GEN-LAST:event_btnOpenDatabaseActionPerformed

    private void btnQueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQueryActionPerformed
        performQuery();
        btnGenRnd.setEnabled(true);
    }//GEN-LAST:event_btnQueryActionPerformed

    private void rdoGluActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoGluActionPerformed
        boolGlu = true;
        chkGluOnly.setEnabled(true);
        btnGenRnd.setEnabled(false);
    }//GEN-LAST:event_rdoGluActionPerformed

    private void rdoGABAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoGABAActionPerformed
        boolGlu = false;
        chkGluOnly.setSelected(false);
        chkGluOnly.setEnabled(false);
        btnGenRnd.setEnabled(false);
    }//GEN-LAST:event_rdoGABAActionPerformed

    private void rdoOutputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoOutputActionPerformed
        boolInput = false;
        btnGenRnd.setEnabled(false);
    }//GEN-LAST:event_rdoOutputActionPerformed

    private void rdoInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoInputActionPerformed
        boolInput = true;
        btnGenRnd.setEnabled(false);
    }//GEN-LAST:event_rdoInputActionPerformed

    private void lblEmailMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEmailMouseClicked
        URIHandle.mailme();
    }//GEN-LAST:event_lblEmailMouseClicked

    private void lblEmailMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEmailMouseEntered
        lblEmail.setForeground(Color.BLUE);
    }//GEN-LAST:event_lblEmailMouseEntered

    private void lblEmailMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEmailMouseExited
        lblEmail.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblEmailMouseExited

    private void compareVRnd() {
        int genCycle = Integer.parseInt(txtCycles.getText());
        SummaryStatistics[] sums = new SummaryStatistics[arrRndGen[0].length];
        for (int i = 0; i < sums.length; i++) {
            sums[i] = new SummaryStatistics();
        }

        for (int i = 0; i < genCycle; i++) {
            for (int j = 0; j < sums.length; j++) {
                sums[j].addValue(arrRndGen[i][j]);
            }
        }
        qryTableData[2][0] = "Exp";
        qryTableData[3][0] = "S.D.";
        qryTableData[4][0] = "S.E.M.";
        qryTableData[5][0] = "z";
        qryTableData[6][0] = "p";


        for (int i = 0; i < sums.length; i++) {
            qryTableData[2][i + 1] = new Double(sums[i].getMean());
            qryTableData[3][i + 1] = new Double(sums[i].getStandardDeviation());
            qryTableData[4][i + 1] = new Double(sums[i].getStandardDeviation() / Math.sqrt(genCycle));
            double z = (degree[i] - sums[i].getMean()) / sums[i].getStandardDeviation();
            qryTableData[5][i + 1] = new Double(z);
            qryTableData[6][i + 1] = StatisticsConversion.twoTailPvalue(Math.abs(z));
        }
        MyTableModel cpTable = new MyTableModel(qryTableData);
        qryTable.setModel(cpTable);
    }

    private void btnOpenDbDefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenDbDefaultActionPerformed
        pathToFile = CommonsLib.getDefaultFile();

        btnQuery.setEnabled(true);

    }//GEN-LAST:event_btnOpenDbDefaultActionPerformed

    private void btnGenRndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenRndActionPerformed
        if (rdoBoth.isSelected()) {
            GenBoth newGen = chkGluOnly.isSelected() ? new GenBoth(pathToFile, true) : new GenBoth(pathToFile, false);
            int genCycle = Integer.parseInt(txtCycles.getText());
            arrRndGen = new int[genCycle][4];
            for (int i = 0; i < genCycle; i++) {
                arrRndGen[i] = newGen.getExpDegree(boolGlu);
            }
        } else {
            GenIO newGen = chkGluOnly.isSelected() ? new GenIO(pathToFile, true) : new GenIO(pathToFile);
            int genCycle = Integer.parseInt(txtCycles.getText());
            arrRndGen = new int[genCycle][4];
            for (int i = 0; i < genCycle; i++) {
                arrRndGen[i] = newGen.getExpDegree(boolGlu, boolInput);
            }
        }
        compareVRnd();
    }//GEN-LAST:event_btnGenRndActionPerformed

    private void rdoBothActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoBothActionPerformed
        btnGenRnd.setEnabled(false);
    }//GEN-LAST:event_rdoBothActionPerformed

    private void performQuery() {
//        int[] degree;
        String[] head;
        if (rdoBoth.isSelected()) {
            GenBoth gen = chkGluOnly.isSelected() ? new GenBoth(pathToFile, true) : new GenBoth(pathToFile, false);
            degree = gen.getObsDegree(boolGlu);
            txtTotalCell.setText(Integer.toString(gen.getTotalCell(boolGlu)));
            String[] currHead = {"0Deg", "1Deg", "2Deg", "3Deg", "4Deg", "5Deg", "6Deg"};
            head = currHead;
        } else {
            GenIO gen = chkGluOnly.isSelected() ? new GenIO(pathToFile, true) : new GenIO(pathToFile);
            degree = gen.getObsDegree(boolGlu, boolInput);
            txtTotalCell.setText(Integer.toString(gen.getTotalCell(boolGlu, boolInput)));
            String[] currHead = {"0Deg", "1Deg", "2Deg", "3Deg"};
            head = currHead;
        }

        int totalConn = 0;
        for (int i = 1; i < degree.length; i++) {
            totalConn += degree[i] * i;
        }
        txtTotalConn.setText(Integer.toString(totalConn));

        qryTableData = new Object[7][degree.length + 1];
        System.arraycopy(head, 0, qryTableData[0], 1, head.length);
        qryTableData[1][0] = "OBS";
        for (int i = 0; i < degree.length; i++) {
            qryTableData[1][i + 1] = degree[i];
        }
        MyTableModel qryTableModel = new MyTableModel(qryTableData);
        qryPane.setColumnHeaderView(null);
        qryTable.setModel(qryTableModel);

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(IO.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new IO().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFileChooser DataFileChooser;
    private javax.swing.JButton btnGenRnd;
    private javax.swing.JButton btnOpenDatabase;
    private javax.swing.JButton btnOpenDbDefault;
    private javax.swing.JButton btnQuery;
    private javax.swing.JCheckBox chkGluOnly;
    private javax.swing.ButtonGroup gluGABAGroup;
    private javax.swing.ButtonGroup inOutGroup;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblDoQuery;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblOpenDatabase;
    private javax.swing.JLabel lblQueryOption;
    private javax.swing.JScrollPane qryPane;
    private transient javax.swing.JTable qryTable;
    private javax.swing.JRadioButton rdoBoth;
    private javax.swing.JRadioButton rdoGABA;
    private javax.swing.JRadioButton rdoGlu;
    private javax.swing.JRadioButton rdoInput;
    private javax.swing.JRadioButton rdoOutput;
    private javax.swing.JTextField txtCycles;
    private javax.swing.JTextField txtTotalCell;
    private javax.swing.JTextField txtTotalConn;
    // End of variables declaration//GEN-END:variables
    private String pathToFile;
    private boolean boolGlu = true;
    private boolean boolInput = true;
    private int[][] arrRndGen;
    private Object[][] qryTableData;
    private int[] degree;
;
}
